#!/usr/bin/env python
# coding: utf-8 

import unittest

from Polinomio import Polinomio

class TestPolinomio(unittest.TestCase):

	def testBuscarRaices(self):
		COEF_RAIZ = [ [(-1, 1, 2), (-1,2)],
					  [(1, -8,12), (2, 6)],
					  [(1, -1,-6), (-2,3)] ]

		for c, resultado in COEF_RAIZ:
			raices = Polinomio().buscarRaices(c[0],c[1],c[2])
			self.assertEquals(raices, resultado)

	def testBuscarCoeficientes(self):
		RAIZ_COEF = [ [(0, 1), (1,-1, 0)],
					  [(1, 1), (1,-2, 1)],
					  [(-1,3), (1,-2,-3)],
					  [(1, 2), (1,-3, 2)] ]

		for r, resultado in RAIZ_COEF:
			coef = Polinomio().buscarCoeficientes(r[0], r[1])
			self.assertEquals(coef, resultado)


if __name__ == '__main__':
    unittest.main()
